﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;

namespace Vehicle_Maintenance
{
    class Service
    {
        public Service() { }
        public string VIN     = string.Empty;
        public string Date    = string.Empty;
        public string Cost    = string.Empty;
        public string SerType = string.Empty;
        public string Odom    = string.Empty;
        public string Loc     = string.Empty;
        public string PayType = string.Empty;

        public void New()
        {
            using (SqlConnection scConnect = new SqlConnection(Properties.Settings.Default.Auto_Log))
            {
                scConnect.Open();
                SqlCommand scCommand  = new SqlCommand();
                scCommand.Connection  = scConnect;
                scCommand.CommandType = CommandType.StoredProcedure;
                scCommand.CommandText = "services_insert";
                scCommand.Parameters.AddWithValue("@VehicleID", this.VIN);
                scCommand.Parameters.AddWithValue("@DateTime", this.Date);
                scCommand.Parameters.AddWithValue("@T_Cost", this.Cost);
                scCommand.Parameters.AddWithValue("@Serv_Type", this.SerType);
                scCommand.Parameters.AddWithValue("@Odom", this.Odom);
                scCommand.Parameters.AddWithValue("@Loc", this.Loc);
                scCommand.Parameters.AddWithValue("@Pay_Type", this.PayType);
                scCommand.ExecuteNonQuery();
                scConnect.Close();
            }
        }

    }
}
